if [ $# -ne 1 ]; then
    echo "错误：请传入一个正整数作为参数（格式：./test10_1.sh 正整数）"
    exit 1
fi
if ! [[ $1 =~ ^[1-9][0-9]*$ ]]; then
    echo "错误：参数必须是正整数"
    exit 1
fi
n=$1
sum=$(( n * (n + 1) / 2 ))
echo "$sum"

